3.2.98 \(\int \frac {\cot ^2(a+i \log (x))}{x} \, dx\) [198]

Optimal. Leaf size=18 \[ i \cot (a+i \log (x))-\log (x) \]

[Out]

I*cot(a+I*ln(x))-ln(x)

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 18, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {3554, 8} \begin {gather*} -\log (x)+i \cot (a+i \log (x)) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cot[a + I*Log[x]]^2/x,x]

[Out]

I*Cot[a + I*Log[x]] - Log[x]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps

\begin {align*} \int \frac {\cot ^2(a+i \log (x))}{x} \, dx &=\text {Subst}\left (\int \cot ^2(a+i x) \, dx,x,\log (x)\right )\\ &=i \cot (a+i \log (x))-\text {Subst}(\int 1 \, dx,x,\log (x))\\ &=i \cot (a+i \log (x))-\log (x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [C] Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.
time = 0.04, size = 34, normalized size = 1.89 \begin {gather*} i \cot (a+i \log (x)) \, _2F_1\left (-\frac {1}{2},1;\frac {1}{2};-\tan ^2(a+i \log (x))\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cot[a + I*Log[x]]^2/x,x]

[Out]

I*Cot[a + I*Log[x]]*Hypergeometric2F1[-1/2, 1, 1/2, -Tan[a + I*Log[x]]^2]

________________________________________________________________________________________

Maple [A]
time = 0.04, size = 29, normalized size = 1.61

method result size
risch \(-\ln \left (x \right )-\frac {2}{\frac {{\mathrm e}^{2 i a}}{x^{2}}-1}\) \(21\)
norman \(\frac {-\ln \left (x \right ) \tan \left (a +i \ln \left (x \right )\right )+i}{\tan \left (a +i \ln \left (x \right )\right )}\) \(27\)
derivativedivides \(-i \left (-\cot \left (a +i \ln \left (x \right )\right )+\frac {\pi }{2}-\mathrm {arccot}\left (\cot \left (a +i \ln \left (x \right )\right )\right )\right )\) \(29\)
default \(-i \left (-\cot \left (a +i \ln \left (x \right )\right )+\frac {\pi }{2}-\mathrm {arccot}\left (\cot \left (a +i \ln \left (x \right )\right )\right )\right )\) \(29\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(a+I*ln(x))^2/x,x,method=_RETURNVERBOSE)

[Out]

-I*(-cot(a+I*ln(x))+1/2*Pi-arccot(cot(a+I*ln(x))))

________________________________________________________________________________________

Maxima [A]
time = 0.49, size = 19, normalized size = 1.06 \begin {gather*} i \, a + \frac {i}{\tan \left (a + i \, \log \left (x\right )\right )} - \log \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(a+I*log(x))^2/x,x, algorithm="maxima")

[Out]

I*a + I/tan(a + I*log(x)) - log(x)

________________________________________________________________________________________

Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 34 vs. \(2 (14) = 28\).
time = 3.22, size = 34, normalized size = 1.89 \begin {gather*} -\frac {{\left (x^{2} - e^{\left (2 i \, a\right )}\right )} \log \left (x\right ) - 2 \, e^{\left (2 i \, a\right )}}{x^{2} - e^{\left (2 i \, a\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(a+I*log(x))^2/x,x, algorithm="fricas")

[Out]

-((x^2 - e^(2*I*a))*log(x) - 2*e^(2*I*a))/(x^2 - e^(2*I*a))

________________________________________________________________________________________

Sympy [A]
time = 0.17, size = 20, normalized size = 1.11 \begin {gather*} - \log {\left (x \right )} + \frac {2 e^{2 i a}}{x^{2} - e^{2 i a}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(a+I*ln(x))**2/x,x)

[Out]

-log(x) + 2*exp(2*I*a)/(x**2 - exp(2*I*a))

________________________________________________________________________________________

Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 32 vs. \(2 (14) = 28\).
time = 0.42, size = 32, normalized size = 1.78 \begin {gather*} i \, a + \frac {i}{2 \, \tan \left (\frac {1}{2} \, a + \frac {1}{2} i \, \log \left (x\right )\right )} - \log \left (x\right ) - \frac {1}{2} i \, \tan \left (\frac {1}{2} \, a + \frac {1}{2} i \, \log \left (x\right )\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(a+I*log(x))^2/x,x, algorithm="giac")

[Out]

I*a + 1/2*I/tan(1/2*a + 1/2*I*log(x)) - log(x) - 1/2*I*tan(1/2*a + 1/2*I*log(x))

________________________________________________________________________________________

Mupad [B]
time = 2.49, size = 16, normalized size = 0.89 \begin {gather*} -\ln \left (x\right )+\mathrm {cot}\left (a+\ln \left (x\right )\,1{}\mathrm {i}\right )\,1{}\mathrm {i} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(a + log(x)*1i)^2/x,x)

[Out]

cot(a + log(x)*1i)*1i - log(x)

________________________________________________________________________________________